<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ page import="com.liuya.db.sql.xml.DefineVariable" %>
<%@ page import="com.liuya.safe.policy.handler.AbstractPolicyDesignHandler" %>
<%@ page import="com.liuya.db.sql.xml.ContextValue" %>
<%@ page import="com.liuya.common.I18N" %>

<%
    I18N i18n = I18N.getInstance();

    DefineVariable var = (DefineVariable) request.getAttribute("variable");
    String oper = "addVariable";
    String name = "";
    String key = "";
    String varIndex = "-1";
    String id = request.getParameter("id");

    if (var != null) {
        ContextValue value = var.getContextValue();

        varIndex = request.getParameter("index");
        oper = "updateVariable";
        key = value.getKey();
        name = var.getName();
    }
%>


<input type="hidden" name="oper" value="<%=oper%>"/>
<input type="hidden" name="id" value="<%=id%>"/>
<input type="hidden" name="type" value="contextValue"/>
<input type="hidden" name="index" value="<%=varIndex%>"/>
<label><%=i18n.say("Variable_name")%>
</label>
<input type="text" name="name" value="<%=name%>" class="required"/>
<br/>
<label><%=i18n.say("Context_key")%>
</label>
<input type="text" name="key" value="<%=key%>" class="required"/>
